﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VoiceMessager.Stream.Cmd;

namespace VoiceMessager.Stream
{
	public static class SendFactory
	{
		public static SendStream Create(byte order, byte sum, VerifyMethod verifyMethod, CmdStream cmdStream)
		{
			var stream = new SendStream
			{
				Header = new byte[] {0x01, 0x02, 0x73},
				Order = order,
				Sum = sum,
				VerifyMethod = (byte) verifyMethod,
				SendData = cmdStream.GetBytes()
			};
			stream.DataLength = BitConverter.GetBytes(stream.SendData.Length)[0];
			stream.VerifyData = Statics.GetVerifyBytes(verifyMethod, stream.SendData);
			stream.Stop = 0x0D;
			return stream;
		}
	}
}
